package com.example.jetpackdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.example.jetpackdemo.basic_camera.BasicCameraActivity;
import com.example.jetpackdemo.basic_camera.FirstCameraActivity;
import com.example.jetpackdemo.camera.CameraActivity;
import com.example.jetpackdemo.camera.CameraViewActivity;
import com.example.jetpackdemo.kotlin.CaptureActivity;
import com.permissionutil.AdapterPermissionListener;
import com.permissionutil.Permission;
import com.permissionutil.PermissionImpl;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        PermissionImpl.init(this).permission(Permission.CAMERA,Permission.WRITE_EXTERNAL_STORAGE,Permission.RECORD_AUDIO)
                .requestPermission(new AdapterPermissionListener(){
                    @Override
                    public void onGranted() {
                        Toast.makeText(MainActivity.this, "有权限了", Toast.LENGTH_SHORT).show();
                    }
                });
    }

    public void camera(View view) {
        CameraActivity.start(this);
    }

    public void cameraView(View view) {
        CameraViewActivity.start(this);
    }

    public void capture(View view) {
        startActivity(new Intent(this, CaptureActivity.class));
    }

    public void basicCamera(View view) {
        startActivity(new Intent(this, BasicCameraActivity.class));
    }

    public void firstCamera(View view) {
        startActivity(new Intent(this, FirstCameraActivity.class));
    }
}